﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Traceability.App.Api.Application.Command.Detail.Slaughter;
using Traceability.App.ErrorCount;
using Traceability.App.Model.Slaughter;

namespace Traceability.App.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SlaughterController : ControllerBase
    {
        IMediator mediator;

        public SlaughterController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        [HttpPost]
        public Task<ApiResult<int>> AddSlaughter(AddSlaughterCommand request)
        {
            return mediator.Send(request);
        }
        [HttpPost]
        public Task<ApiResult<int>> AddSlaughterCompany(AddSlaughterCommpanyCommand request)
        {
            return mediator.Send(request);
        }
        [HttpGet]
        public Task<ApiResult<SlaughterModel>> GetSlaughter([FromQuery]GetSlaughterCommand request)
        {
            return mediator.Send(request);
        }
        [HttpGet]
        public Task<ApiResult<SlaughterCommpanyModel>> GetSlaughterCompany([FromQuery]GetSlaughterCommpanyCommand request)
        {
            return mediator.Send(request);
        }
    }
}
